//
//  Subscript.swift
//  SwiftDemo
//
//  Created by lizq on 16/7/6.
//  Copyright © 2016年 lizq. All rights reserved.
//

import UIKit

struct TimesTable {
    let multiplier: Int
    subscript (index: Int) -> Int {
        return multiplier * index
    }
}

class Subscript: NSObject {
    func action() {
        let threeTimesTable = TimesTable(multiplier: 3)
        print("3的6倍是：\(threeTimesTable[6])")
    }
}
